﻿<?php //Seyret Component v.0.3//
/**
* @package Seyret
* @version 0.3
* @copyright Copyright (C) 2008 Mustafa DINDAR. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Seyret Video Component is a free software.
* See seyrettos.html for license notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );


$document = & JFactory::getDocument();

$jslink=JURI :: root()."components/com_seyret/includes/js/jquery-ui-1.7.2.custom.min.js";
$document->addScript($jslink);




$jslink=JURI :: root()."components/com_seyret/includes/js/tools.expose-1.0.5.min.js";
$document->addScript($jslink);



$jslink=JURI :: root()."components/com_seyret/includes/js/jquery.alerts.js";
$document->addScript($jslink);





$jslink=JURI :: root()."components/com_seyret/includes/js/seyretplayer.js";
$document->addScript($jslink);

$jslink=JURI :: root()."components/com_seyret/includes/js/playerconf.js";
$document->addScript($jslink);

$jslink=JURI :: root()."components/com_seyret/includes/js/".$this->plcspfile.".js";
$document->addScript($jslink);



echo $this->toolbar;
echo $this->modtoolbar;


$session =& JFactory::getSession();
$seyretmessagetype=$session->get('seyret.messagetype');
$seyretmessage=$this->seyretmessage($seyretmessagetype);
$session->clear('seyret.messagetype');


$video=$this->videoData;
$user =& JFactory::getUser();


$documenttitle = $video->videotitle;
$document->setTitle($documenttitle);

$documentdesc= htmlentities($video->videodescription);
$document->setMetaData('description', $documentdesc);

$document->setMetaData('keywords', $video->videotags);

$vtitle= str_replace("\"", "", $video->videotitle). " - ". $video->id;
$document->setMetaData('title',  $vtitle);
$imagesrc=htmlentities($video->videothumbnail);
$document->setLink ('image_src',  "");
$document->addHeadLink( $imagesrc, 'image_src', 'rel' );


if ($video->defaultcontentadlink != "") {
	$jslink=$video->defaultcontentadlink;
	$document->addScript($jslink);
} else {
	$jslink=JURI :: root()."components/com_seyret/includes/js/playerconf2.js";
	$document->addScript($jslink);
}


?>

<script type="text/javascript">


jQuery(document).ready(function(){



	jQuery.seyrettools.createmultibox("iframe", "emailtofriend");
	jQuery.seyrettools.createmultibox("iframe", "sbookmarks");
	jQuery.seyrettools.createmultibox("inline", "shareonsbox", null , null , "#shareonsite_js");
	jQuery.seyrettools.createmultibox("iframe", "flagbuttonlink");
	jQuery.seyrettools.createmultibox("iframe", "favoritebuttonlink");
	jQuery.seyrettools.createmultibox("iframe", "reportcommentlink");
	jQuery.seyrettools.createmultibox("iframe", "statsbuttonlink");


	
	wrcommentonclosef = function () {
		var rawurl = '<?php echo JURI::root();?>index.php?option=com_seyret&amp;view=comments&amp;task=getcomments&amp;format=raw&amp;vid=<?php echo $video->id;?>&amp;page=1';
		var newurl = rawurl.replace(/&amp;/g, "&");
		jQuery.ajax({
			type: 'GET',
			url: newurl, 
			data: '', 			
			success: function(ajaxCevap) {
				jQuery("#seyretvcommentsidiv_js").html(ajaxCevap);
				jQuery.seyrettools.createmultibox("iframe", "editcommentlink", "editcommentonclosef");
				jQuery.seyrettools.createmultibox("iframe", "reportcommentlink");
				
			} 				
		});
	}	
	jQuery.seyrettools.createmultibox("iframe", "writecommentlink", "wrcommentonclosef");
	
	editcommentonclosef = function () {
		var rawurl = '<?php echo JURI::root();?>index.php?option=com_seyret&amp;view=comments&amp;task=getcomments&amp;format=raw&amp;vid=<?php echo $video->id;?>&amp;page=1'; 
		var newurl = rawurl.replace(/&amp;/g, "&");
		jQuery.ajax({
			type: 'GET',
			url: newurl, 
			data: '', 			
			success: function(ajaxCevap) {
				jQuery("#seyretvcommentsidiv_js").html(ajaxCevap);
				jQuery.seyrettools.createmultibox("iframe", "editcommentlink", "editcommentonclosef");
				jQuery.seyrettools.createmultibox("iframe", "reportcommentlink");
			} 				
		});
	}
	
	jQuery.seyrettools.createmultibox("iframe", "editcommentlink", "editcommentonclosef");
						
				

	jQuery.seyrettools.createddeletevideobox();
		
		



	});
	
	
	
	

	
	
	

</script>	


<div>

	<div id="seyretmessage" class="<?php echo $seyretmessagetype;?>">
		<?php echo $seyretmessage;?>
	</div>	

	<div id="info"></div>
				
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<!-- begin left column -->
		<td valign="top" width="1%">
			<div id="videoscreenblock">
				<div id="videotitle_js">
					<?php echo $video->videotitle;?>
				</div>
				
				<div id="videoembed_js" class="videoembed_js"> <!-- Don't change div id-->
					<?php echo $video->embedcode;?>
				</div>



					
				<div id="ratingetcblock_js">
				
					<?php
					//Check permission for rating stars.********************** START *****************
					if ($this->registry->getValue('permission.access.canseeratingstars')=="1") {
					?>	
				
					<div style="float:left;">
						<?php echo JText::_('Rate').": ";?>
				
					</div>

					<div id="rating">
						<?php echo $video->votestars;?>
					</div>

					
					<div id="ratingcount">
						<?php 
						echo $video->voteclick;
						//Check permission for rating access.********************** START *****************
						if ($this->registry->getValue('permission.access.canratevideo')=="1") {
							echo " " . JText::_('ratings') ;
						} else {
							echo " " .  JText::_('ratings')." - " . JText::_('Login to rate') ;
						}
						//Check permission for rating access.********************** END *****************
							
						?>
					</div>

				
					
					<?php
					}
					//Check permission for rating stars.********************** END *****************
					?>

					
					<div id="viewsinfo">
						<?php echo JText::_('Views').": ".$video->hits;?>
					
					</div>
					
					<div id="lightsoff" style="float:right; padding-right:5px; cursor:pointer;" onclick="jQuery('div.videoembed_js').expose({ api: true, speed: 1500, color:'#000000', opacity: 0.9,  zIndex: 1,  onClose: null }).load();">
						<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/lamp_16.png" alt="<?php echo JText::_('Lights Off');?>" />
						
					
					</div>

					
					<div style="clear:both;"></div>
					
				</div>
			
			</div>
		
		
		
		{seyretmod6}
		
		

<script type="text/javascript">
	jQuery(function() {
		index = jQuery.cookie('videodetstab');
		if (!index) index = 0;
		
		jQuery("#tabsvideodets").tabs({ cookie: { expires: 30, name: 'videodetstab', path: '/' },  selected: index });
	});
</script>



<div class="jquerytabs">

<div id="tabsvideodets">
	<ul>
		<li><a href="#tabs-1"><?php echo JText::_('Share');?></a></li>
		<li><a href="#tabs-2"><?php echo JText::_('Actions');?></a></li>

	</ul>
	<div id="tabs-1"  >
		
					<?php
					//Check permission for email button.********************** START *****************
					if ($this->registry->getValue('permission.access.sendtofriendbutton')=="1") {
					?>						
						
						<!-- send to friend email box  *************** START ************* -->
						<div id="emailFormCont_js"><a href="<?php echo JURI::root(); ?>index.php?option=com_seyret&amp;view=tools&amp;task=emailtofriend&amp;tmpl=component&amp;vid=<?php  echo $video->id; ?>&amp;title=<?php echo urlencode($video->videotitle);?>&amp;iframe=true&amp;width=450&amp;height=370" rel="emailtofriend" class="emailtofriend" title="<?php echo JText::_('Send to a friend'); ?>"><?php echo JText::_('Send to a friend'); ?></a></div>

						<!-- send to friend email box  *************** END ************* -->	
		
				
					<?php
					}
					//Check permission for email button.********************** END *****************
					?>


					<?php
					//Check permission for bookmarks button.********************** START *****************
					if ($this->registry->getValue('permission.access.socialbookmarksbutton')=="1") {
					?>	
					
					
						<!-- bookmarks box  *************** START ************* -->
						<div id="bookmarksCont_js"><a href="<?php echo JURI::root(); ?>index.php?option=com_seyret&amp;view=tools&amp;task=socialbookmarks&amp;tmpl=component&amp;vid=<?php  echo $video->id; ?>&amp;iframe=true&amp;width=250&amp;height=290" rel="sbookmarks" class="sbookmarks" title="<?php echo JText::_('Social Bookmarks'); ?>"><?php echo JText::_('Social Bookmarks'); ?></a></div>

						<!-- bookmarks box  *************** END ************* -->
						
						<?php
						}
						//Check permission for bookmarks button.********************** END *****************
						
						?>


						
						<!-- shareonsite_js box  *************** START ************* -->
						<div id="shareonsiteCont_js"><a href="#shareonsite_js&amp;width=250&amp;height=290" rel="shareonsbox" class="shareonsbox" title="<?php echo JText::_('Publish on your site'); ?>"><?php echo JText::_('Publish on your site'); ?></a></div>

						<!-- shareonsite_js box  *************** END ************* -->
						
						
						<!-- MULTIBOX OVERLAY DIVS  *************** START ************* -->
						<div style="clear:both;"></div>
						<div style="display:none;">
						<div id="shareonsite_js" >
							<div style="padding:10px;">
							
								<div>
									<?php echo JText::_('URL').":"?>
								</div>

								<div>
									<?php echo $video->videourlbox2;?>
								</div>
								
								
								<?php 
								if ($video->videoembedbox2!="disabled") {
								?>
									<div>
										<?php echo JText::_('Embed').":"?>
									</div>

									<div>
										<?php echo $video->videoembedbox2;?>
									</div>								
								
								<?php
								
								}
								
								
								?>


								
							</div>
						</div>
						</div>
						
						<!-- MULTIBOX OVERLAY DIVS  *************** END ************* -->
						
						
						
						<div style="clear:both;"></div>
	</div>
	<div id="tabs-2"  >
		
					
					<?php
					//Check permission to edit videos.********************** START *****************
					if ($this->registry->getValue('permission.administration.caneditallvideos')=="1" OR ($this->registry->getValue('permission.administration.caneditownvideos')=="1" AND $video->addedby==$user->id) ) {
					?>
					<div id="editButtonDiv_js"><a href="<?php echo $this->absURL("index.php?option=com_seyret&view=editvideo&id=".$video->id); ?>" class="editbuttonlink"><?php echo JText::_('Edit Video');?></a></div>
					<?php
					} else {
					?>
					<div id="editButtonDiv_js" style="display:none;"></div>
					<?php
					}
					//Check permission to edit videos.********************** END *****************
					?>
	

					<?php
					//Check permission to delete videos.********************** START *****************
					if ($this->registry->getValue('permission.administration.candeleteallvideos')=="1" OR ($this->registry->getValue('permission.administration.candeleteownvideos')=="1" AND $video->addedby==$user->id) ) {
					?>
					<div id="deleteButtonDiv_js"><a href="<?php echo $this->absURL("index.php?option=com_seyret&view=editvideo&task=deletevideo&id=".$video->id); ?>" name="deletebuttonlink_js" id="deletebuttonlink_js" class="deletebuttonlink_js"><?php echo JText::_('Delete Video');?></a></div>
					<?php
					} else {
					?>
					<div id="deleteButtonDiv_js" style="display:none;"></div>
					
					<?php
					}
					//Check permission to delete videos.********************** END *****************
					?>


					<?php
					//Check permission to flag videos.********************** START *****************
					if ($this->registry->getValue('permission.access.flagvideosbutton')=="1") {
					?>

					<!-- flagvideo box  *************** START ************* -->
					<div id="flagButtonDiv_js"><a href="index.php?option=com_seyret&amp;view=tools&amp;task=flagvideo&amp;tmpl=component&amp;vid=<?php echo $video->id; ?>&amp;title=<?php echo urlencode($video->videotitle);?>&amp;iframe=true&amp;width=550&amp;height=350" rel="flagbuttonlink" class="flagbuttonlink " title="<?php echo JText::_('Flag Video');?>"><?php echo JText::_('Flag Video');?></a></div>

					<!-- flagvideo box  *************** END ************* -->					
					<?php
					}
					//Check permission to flag videos.********************** END *****************
					?>

					
					
					<?php
					//Check permission to favorite videos.********************** START *****************
					if ($this->registry->getValue('permission.access.addfavoritesbutton')=="1") {
					?>

					<!-- favoritevideo box  *************** START ************* -->
					<div id="favoriteButtonDiv_js"><a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=tools&amp;task=addfavorite&amp;tmpl=component&amp;vid=".$video->id); ?>&amp;iframe=true&amp;width=400&amp;height=100" rel="favoritebuttonlink" class="favoritebuttonlink " title="<?php echo JText::_('Add to Favorite');?>"><?php echo JText::_('Favorite');?></a></div>

					<!-- favoritevideo box  *************** END ************* -->					
					<?php
					}
					//Check permission to favorite videos.********************** END *****************
					?>
					
					
					<?php
					//Check permission for video statistics.********************** START *****************
					if ($this->registry->getValue('permission.access.canseeallvideostatistics')=="1" OR ($this->registry->getValue('permission.access.canseeownvideostatistics')=="1" AND $video->addedby==$user->id) ) {
					?>
					<div id="statsbuttondiv_js"><a href="<?php echo $this->absURL("index.php?option=com_seyret&view=statistics&task=videostats&tmpl=component&vid=".$video->id); ?>&amp;iframe=true&amp;width=900&amp;height=600" rel="statsbuttonlink" class="statsbuttonlink"><?php echo JText::_('Statistics');?></a></div>
					<?php
					} else {
					?>
					<div id="statsbuttondiv_js" style="display:none;"></div>
					<?php
					}
					//Check permission to edit videos.********************** END *****************
					?>					
					
					
					
					
					<div style="clear:both;"></div>
	</div>

	
</div>

</div>


			
			

			
			
			<div id="commentsdiv">
				<?php echo $this->commentstpl; ?>
			</div>
			
			
			<?php
			if ($this->registry->getValue('permission.access.canwritecomments') == "1") {
			
			?>
			<div id="writecomment">
				
					<!-- commentseditor box  *************** START ************* -->
					<div id="writeCommentButtonDiv_js"><a href="<?php echo $this->absURL("index.php?option=com_seyret&amp;view=comments&amp;task=geteditor&amp;vid=".$video->id."&amp;tmpl=component" ) ;?>&amp;iframe=true&amp;width=620&amp;height=490" rel="writecommentlink" class="writecommentlink " title="<?php echo JText::_('Write Comment');?>"><?php echo JText::_('Write Comment');?></a></div>
					
					<!-- commentseditor box  *************** END ************* -->						
			</div>
			<?php
			}
			
			?>
			
			
				

		</td>
		<!-- end left column -->
		
		
		<!-- begin right column -->
		<td valign="top">
		
		

			
			
			<div id="channelbannercontainer_js">
				<?php if ($video->channelbanner !="") {
				?>
				
					<div id="channelbanner">
						<img src="<?php echo $video->channelbanner;?>" alt =""/>
					</div>
				<?php
				
				} 
				
				?>
				
			</div>
		
			<div id="videoinfoblock_js">
				<div id="owneravatar">
					
					<?php echo $video->owneravatar;?>
					
				</div>
				
				<div id="ownerdetails">
					<div id="ownerusername">
						<?php echo JText::_('From').": ".$video->ownerusername;?>
					</div>

					<div id="ownerregisterdate">
						<?php //echo JText::_('Joined').": ".$video->ownerregisterdate;?>
					</div>

					<div id="ownervideocount">
						<?php echo JText::_('Videos').": ".$video->ownervideocount;?>
					</div>

				</div>
				
				<div style="clear:both;"></div>

				
				<div id="addeddateblock">
					<?php echo JText::_('Added').": ".$video->addeddate;?>
				</div>

				<div id="videooriginalurl">
					<?php if ($video->videourl!="") echo $video->videooriginallocation;?>
				</div>	

				
				<div id="videodescription">
					<?php echo $video->videodescription;?>
				</div>		

				<div id="videotags">
					<?php echo JText::_('Tags'). ": ".$video->videotaglist;?>
				</div>	
				
				
				<div id="videourlboxdivlabel">
					<?php echo JText::_('URL').":"?>
				</div>

				<div id="videourlboxdiv">
					<?php echo $video->videourlbox;?>
				</div>
				
				<?php 
				if ($video->videoembedbox!="disabled") {
				?>
					<div>
						<?php echo JText::_('Embed').":"?>
					</div>

					<div>
						<?php echo $video->videoembedbox;?>
					</div>								
				
				<?php
				
				}
				
				
				?>		
				
			</div>
			

			
			
<?php 

// --------------------- QUICKLIST--------------------------------
if (count($this->quicklistdata) > 0) {
?>
<div id="quicklisttitle" style="float:left;"><?php echo JText::_('Quick List'); ?></div>


<div id="quicklistoperations">
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlsave.png" onclick="jQuery.seyrettools.savequicklist();" alt="" />
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlclear.png" onclick="jQuery.seyrettools.clearquicklist();" alt="" />
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlplay.png" onclick="jQuery.seyrettools.playquicklist();" alt="" />
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlnext.png" onclick="jQuery.seyrettools.playqlnextitem();" alt="" />
	
	
</div>

<div class="clear"></div>

<div class="quicklistbox" id="quicklist">

<?php
	$counter=0;
	foreach ($this->quicklistdata as $quicklistdt) {
		$counter++;
?>	
	<div class="quicklistrow  qlclipid<?php echo $counter - 1;?> <?php if ($quicklistdt->id == $video->id) echo "qlplayingrow";?>" id="quicklistrow<?php echo $quicklistdt->id?>">
		<div class="quicklistrownumber"><?php echo $counter;?></div>
		<img class="quicklistrowthumb" src="<?php echo htmlentities($quicklistdt->videothumbnail); ?>" id="quicklistth<?php echo $quicklistdt->id?>" alt="" onclick="jQuery.seyrettools.quicklistplayitem('quicklistrow<?php echo $quicklistdt->id?>')" />
		<div class="quicklistrowvideotitle"  id="quicklistttl<?php echo $quicklistdt->id?>" onclick="jQuery.seyrettools.quicklistplayitem('quicklistrow<?php echo $quicklistdt->id?>')" ><?php echo $quicklistdt->videotitle; ?></div>
		<div class="quicklistrowqlnxlink"  id="quicklistnxl<?php echo $quicklistdt->id?>"><?php echo $quicklistdt->videonojxlink; ?></div>
		<img class="removefromquicklistbtn" src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlvremove.png" id="quicklistremove<?php echo $quicklistdt->id?>" onclick="jQuery.seyrettools.removefromquicklist('quicklistremove<?php echo $quicklistdt->id?>');" alt="<?php echo JText::_('Remove from quick list'); ?>" />
		<div class="clear"></div>
	</div>
<?php
	}

?>
	
</div>




<?php
} //end of quick list
?>		







<?php 
if (isset($this->playlistdata)) {


//------------- PLAYLIST
?>
<div id="playlisttitle" style="float:left;"><?php echo JText::_('Playlist'); ?></div>


<div id="playlistoperations">
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlplay.png" onclick="jQuery.seyrettools.playplaylist();" alt="" />
		<img src="<?php echo JURI::root();?>components/com_seyret/themes/default/images/qlnext.png" onclick="jQuery.seyrettools.playplnextitem();" alt="" />
	
	
</div>

<div class="clear"></div>

<div class="playlistbox" id="playlist">

<?php
	$counter=0;
	foreach ($this->playlistdata as $playlistdt) {
		$counter++;
?>	
	<div class="playlistrow  plclipid<?php echo $counter - 1;?> <?php if ($playlistdt->id == $video->id) echo "plplayingrow";?>" id="playlistrow<?php echo $playlistdt->id?>" onclick="jQuery.seyrettools.playlistplayitem('playlistrow<?php echo $playlistdt->id?>')" >
		<div class="playlistrownumber"><?php echo $counter;?></div>
		<img class="playlistrowthumb" src="<?php echo htmlentities($playlistdt->videothumbnail); ?>" id="playlistth<?php echo $playlistdt->id?>" alt=""/>
		<div class="playlistrowvideotitle playlistrow<?php echo $playlistdt->id?>"><?php echo $playlistdt->videotitle; ?></div>
		<div class="playlistrowqlnxlink"  id="playlistnxl<?php echo $playlistdt->id?>"><?php echo $playlistdt->videonojxlink; ?></div>
		<div class="clear"></div>
	</div>
<?php
	}

?>
	
</div>



<?php
} //end of playlist 
?>			
			
			<?php echo $this->relatedvideostpl; ?>
			<?php echo $this->categoryvidstpl; ?>

		</td>
		<!-- end right column -->
	</tr>
</table>


	
	



</div>




